﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;

namespace JSKE
{
    public partial class BreaktimeDlg : FormLang
    {
        public BreakTime BreaktimeValue { get; private set; }
        public BreaktimeDlg()
        {
            //InitializeComponent();
        }
        public BreaktimeDlg(BreakTime bt) : this()
        {
            dtpStart.Value = bt.Start.ToDateTime;
            dtpEnd.Value = bt.End.ToDateTime;
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                BreaktimeValue = new BreakTime(new BKTimePoint(dtpStart.Value), new BKTimePoint(dtpEnd.Value));
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (BreaktimeException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }
    }
}
